<!--用户信息-->
<template>
  <el-form :model="userInfo" status-icon  ref="userInfo" label-width="100px" class="demo-ruleForm">
    <el-form-item label="用户名" prop="pass">
      <el-input  type="text" v-model="userInfo.userName" auto-complete="off"></el-input>
    </el-form-item>
    <el-form-item label="账号" prop="checkPass">
      <el-input  type="text" v-model="userInfo.userAccount" auto-complete="off"></el-input>
    </el-form-item>
    <el-form-item label="创建时间" prop="age">
      <el-input  v-model="userInfo.createdTime"></el-input>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  data () {
    return {
      userInfo: {
        userName: '',
        userAccount: '',
        userPwd: '',
        userType: '',
        createdTime: ''
      }
    }
  },
  created () {
    this.getUserInfo()
  },
  methods: {
    getUserInfo () {
      let userJson = sessionStorage.getItem('user')
      var user = JSON.parse(userJson)
      var userId = user.id
      console.log(userId)
      this.$axios.get(`/users/${userId}`).then(res => {
        this.userInfo = res.data.data
      })
    }
  }
}
</script>
